home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: [Perf:] mem*() procs vs. array looping
- Date: Wed, 28 Feb 96 20:03:43 GMT
- Organization: none
- Message-ID: <825537823snz@genesis.demon.co.uk>
- References: <4glkq1$gu7@gazette.tandem.com> <4h1n14$3b3@news.interpath.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4h1n14$3b3@news.interpath.net>
- softbase@mercury.interpath.net
- "Scott McMahan - Softbase Systems" writes:
-
- >4. I had a program where memset was THE bottleneck, taking up more time
- >than I/O. I re-wrote a memory zeroing function using the most unrolled,
- >efficient loop I could write, and it was still orders of magnitude
- >slower than the system memset. No way I could make it faster in C.
- >
- >5. WRT #4, I removed the memset. It was initializing a buffer, and I
- >said "forget it" and used the uninitialized buffer and took my chances.
-
- What you are suggesting is that you deliberately broke the code. What you
- should have done is analyse the need for zeroing the buffer. That the
- code still worked after the change implies that the zeroing was either
- not necessary or you were depending on the memory allocated to you
- being zeroed to start with. memset is unlikely to be a bottleneck unless
- it is used repeatedly and extensively. In that case it is unlikely that
- you would get such a guarantee and you were using it inappropriately
- in the first place.
-
- >Changing the design was more effecient than coding hokey
- >optimizations!
-
- That is usually true but what you describe above is a 'hokey optimization',
- not a change of design.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-